package de.schlichtherle.license;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
/**
 * 重写trueLicense包里面对应的方法。
 * 读取公钥的方法
 * @author:yecb
 * @email:lps00@163.com
 * @version Revision 2.0.0
 */
public abstract class AbstractKeyStoreParam  implements KeyStoreParam
{
  private final Class clazz;
  private final String resource;

  protected AbstractKeyStoreParam(Class paramClass, String paramString)
  {
    this.clazz = paramClass;
    this.resource = paramString;
  }

  @SuppressWarnings("unused")
public InputStream getStream()
    throws IOException
  {
    InputStream localInputStream = this.clazz.getResourceAsStream(this.resource);
    localInputStream = new FileInputStream(this.resource);//modify by yecb
    if (localInputStream == null) {
        throw new FileNotFoundException(this.resource);
      }
      return localInputStream;
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof KeyStoreParam))
      return false;
    AbstractKeyStoreParam localAbstractKeyStoreParam = (AbstractKeyStoreParam)paramObject;
    return (this.clazz.getResource(this.resource).equals(localAbstractKeyStoreParam.clazz.getResource(localAbstractKeyStoreParam.resource))) && (getAlias().equals(localAbstractKeyStoreParam.getAlias()));
  }
}